﻿<Button Text="点击弹出搜索弹窗" OnClickWithoutRender="@ShowDialog" />
<Logger @ref="Trace" class="mt-3" />

@code {
    [Inject]
    [NotNull]
    private DialogService? DialogService { get; set; }

    [NotNull]
    private Logger? Trace { get; set; }

    private async Task ShowDialog()
    {
        var option = new SearchDialogOption<BindItem>()
        {
            Title = "搜索弹出框",
            Model = new BindItem(),
            OnCloseAsync = () =>
            {
                Trace.Log("关闭按钮被点击");
                return Task.CompletedTask;
            },
            OnResetSearchClick = () =>
            {
                Trace.Log("重置按钮被点击");
                return Task.CompletedTask;
            },
            OnSearchClick = () =>
            {
                Trace.Log("搜索按钮被点击");
                return Task.CompletedTask;
            }
        };

        await DialogService.ShowSearchDialog(option);
    }
}
